<div class="status-bar">
    <div class="inner">
        <div class="left-part">
            <span class="flag"><img src="/luci-static/vssr/flags/4x3/un.svg" class="pure-img"></span> <span
                class="status-info">获取中...</span>
        </div>
        <div class="right-part">
            <div class="icon-con">
                <img src="/luci-static/vssr/img/site_icon1_01.png" class="pure-img i1">
                <img src="/luci-static/vssr/img/site_icon1_02.png" class="pure-img i2">
                <img src="/luci-static/vssr/img/site_icon1_03.png" class="pure-img i3">
                <img src="/luci-static/vssr/img/site_icon1_04.png" class="pure-img i4">
            </div>
        </div>
    </div>
</div>


<script>
    var wW = $(window).width();

    function resize() {
        wW = $(window).width();
        lw = $(".main-left").width()
        if (lw == undefined) {
            lw = 0;
        }
        $(".status-bar").width(wW - lw);
        //$(".status-bar .flag").width($(".status-bar .flag").height() / 3 * 4);

        $(".flag-icon").each(function (index, el) {
            if ($(el).height < 60) {
                $(el).parent.height(60);
                $(el).width(60)
            } else {
                $(el).width($(el).height());
            }
        });
    }

    function wirte_status(data) {
        if (data.outboard) {
            json = data.outboardip;
            $(".flag img").attr("src", VSSR_ASSETS + "flags/4x3/" + json.flag + ".svg");
            $(".status-info").html(data.outboard + "<br>" + json.country);
        }
        data.baidu ? $(".i1").attr("src", VSSR_ASSETS + "img/site_icon_01.png") : $(".i1").attr("src", VSSR_ASSETS + "img/site_icon1_01.png");
        data.taobao ? $(".i2").attr("src", VSSR_ASSETS + "img/site_icon_02.png") : $(".i2").attr("src", VSSR_ASSETS + "img/site_icon1_02.png");
        data.google ? $(".i3").attr("src", VSSR_ASSETS + "img/site_icon_03.png") : $(".i3").attr("src", VSSR_ASSETS + "img/site_icon1_03.png");
        data.youtube ? $(".i4").attr("src", VSSR_ASSETS + "img/site_icon_04.png") : $(".i4").attr("src", VSSR_ASSETS + "img/site_icon1_04.png");
        setTimeout(function () { $("body").trigger("iploaded", [true]); }, 200);
    }
    XHR.poll(10, CHECK_IP_URL, null,
        function (x, data) {
            wirte_status(data);
        }
    );

    $(document).ready(function () {
        resize();
        $.getJSON(CHECK_IP_URL, wirte_status);
    });

    $(window).resize(resize);

</script>
